/*
 * PSW_View.java
 *
 * Created on 2009年3月22日, 下午2:45
 */
package view;

import model.GetPSW_Model;
import model.View_Model;
import ucm.CheckStaff_UC;

/**
 *
 * @author  马凯
 */
public class PSW_View extends javax.swing.JFrame {

    private Main_View mv;

    /** Creates new form PSW_View */
    public PSW_View(Main_View mv) {
        initComponents();
        this.mv = mv;
        this.setLocationRelativeTo(null);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Psw_La = new javax.swing.JLabel();
        psw_TF = new javax.swing.JTextField();
        ok_Bu = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Password");

        Psw_La.setText("Password:");

        ok_Bu.setText("OK");
        ok_Bu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ok_BuActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Psw_La, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(psw_TF, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(252, Short.MAX_VALUE)
                .addComponent(ok_Bu)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Psw_La)
                    .addComponent(psw_TF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
                .addComponent(ok_Bu)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    private void ok_BuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ok_BuActionPerformed
        CheckStaff_UC.getInstance(this).run();
    }//GEN-LAST:event_ok_BuActionPerformed

    public GetPSW_Model getPswModel() {
        GetPSW_Model gm = new GetPSW_Model();
        gm.setCid(mv.getIDModel().getCid());
        gm.setPsw(psw_TF.getText());
        return gm;
    }
    
    public View_Model getViewModel(){
        View_Model vm = new View_Model();
        vm.setMv(mv);
        vm.setPv(this);
        return vm;
                
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel Psw_La;
    private javax.swing.JButton ok_Bu;
    private javax.swing.JTextField psw_TF;
    // End of variables declaration//GEN-END:variables
}
